package org.example.decorator;

/**
 * @author Zhang Yu
 * @description: 装饰模式:把所需功能按照正确的顺序串联起来进行控制,为已有功能动态地增加更多功能的一种方式,把每个要装饰的功能放在单独的类中,
 *                  并让这个类包装它所要装饰的对象
 * @date 2024/5/20 15:02
 */
public class Test {
    public static void main(String[] args) {
        Person person = new Person("小菜");

        System.out.println("第一种装扮");
        Sneakers sneakers = new Sneakers();
        BigTrouser bigTrouser = new BigTrouser();
        TShirts tShirts = new TShirts();

        sneakers.decorate(person);
        bigTrouser.decorate(sneakers);
        tShirts.decorate(bigTrouser);
        tShirts.show();

        System.out.println("第二种装扮");

        LeatherShoes leatherShoes = new LeatherShoes();
        Tie tie = new Tie();
        Suit suit = new Suit();

        leatherShoes.decorate(person);
        tie.decorate(leatherShoes);
        suit.decorate(tie);
        suit.show();

    }
}
